package 迷宫;

import java.util.*;

public class Main {
    static int N = 110, n, x1, x2, y1, y2;
    static char[][] p = new char[N][N];
    static boolean[][] st = new boolean[N][N];
    static int[] dx = {-1, 0, 1, 0}, dy = {0, 1, 0, -1};

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int T = in.nextInt();
        while (T-- > 0) {
            n = in.nextInt();
            for (int i = 0; i < n; i++) {
                p[i] = in.next().toCharArray();
                Arrays.fill(st[i], false);
            }
            x1 = in.nextInt();
            y1 = in.nextInt();
            x2 = in.nextInt();
            y2 = in.nextInt();
            if (bfs(x1, y1)) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }

    private static boolean bfs(int x, int y) {
        if (p[x][y] == '#') {
            return false;
        }
        Queue<PII> q = new LinkedList<>();
        q.offer(new PII(x, y));
        st[x][y] = true;
        while (!q.isEmpty()) {
            PII t = q.poll();
            if (t.x == x2 && t.y == y2) {
                return true;
            }
            for (int i = 0; i < 4; i++) {
                int a = t.x + dx[i], b = t.y + dy[i];
                if (a < 0 || a >= n || b < 0 || b >= n) {
                    continue;
                }
                if (p[a][b] == '#') {
                    continue;
                }
                if (st[a][b]) {
                    continue;
                }
                st[a][b] = true;
                q.offer(new PII(a, b));
            }
        }
        return false;
    }
}

class PII {
    int x, y;

    public PII(int x, int y) {
        this.x = x;
        this.y = y;
    }
}
